﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
        function divsFunc() {
            document.getElementsByTagName("body")[0].innerHTML = "";
            for (var i = 0; i < 20; i++) {
                var posX = Math.random();
                posX = 1000 * posX;
                posX = Math.floor(posX);
                var posY = Math.random();
                posY = 600 * posY;
                posY = Math.floor(posY);
                var width = Math.random();
                width = 500 * width;
                width = Math.floor(width);
                var lenght = Math.random();
                lenght = 300 * lenght;
                lenght = Math.floor(lenght);
                var num1 = Math.random();
                num1 = 15 * num1;
                num1 = Math.floor(num1);
                var color1 = setCorrectColor(num1);
                var num2 = Math.random();
                num2 = 15 * num2;
                num2 = Math.floor(num2);
                var color2 = setCorrectColor(num2);
                var num3 = Math.random();
                num3 = 15 * num3;
                num3 = Math.floor(num3);
                var color3 = setCorrectColor(num3);
                var num4 = Math.random();
                num4 = 15 * num4;
                num4 = Math.floor(num4);
                var color4 = setCorrectColor(num4);
                var num5 = Math.random();
                num5 = 15 * num5;
                num5 = Math.floor(num5);
                var color5 = setCorrectColor(num5);
                var num6 = Math.random();
                num6 = 15 * num6;
                num6 = Math.floor(num6);
                var color6 = setCorrectColor(num6);
                var myDiv = document.createElement("div");
                myDiv.style.width = width;
                myDiv.style.height = lenght;
                myDiv.style.position = "absolute";
                myDiv.style.left = posX;
                myDiv.style.top = posY;
                myDiv.style.background = "#"+color1+color2+color3+color4+color5+color6;
                myDiv.style.border = "4px solid #ffff00";
                document.body.appendChild(myDiv);
            }
        }
        function setCorrectColor(color) 
        {
            switch (color) {
                case 10:
                    color = "A";
                    break;
                case 11:
                    color = "B";
                    break;
                case 12:
                    color = "C";
                    break;
                case 13:
                    color = "D";
                    break;
                case 14:
                    color = "E";
                    break;
                case 15:
                    color = "F";
                    break;
            }
            return color;
        }
        setInterval('divsFunc()', 1000);
</script>
</head>
<body>

</body>
</html>
